import path from 'path'
import * as os from "os";
import {fileURLToPath} from "url";

// 获取用户主目录
let homeDir = os.homedir();

// AppData目录在Windows系统通常位于用户主目录下的AppData\Local
let appDataLocal = path.join(homeDir, '\\AppData\\Local');

function getHomeDir() {
    return homeDir;
}

export function getAppDataLocalPath() {
    return appDataLocal;
}

export function getDirnameByMeterPath(importMeteUrl) {
    const __filenameNew = fileURLToPath(importMeteUrl)
    // 当前文件所在目录
    return path.dirname(__filenameNew)
}

export function pathJoin(...paths) {
    return path.join(...paths)
}
